//package be.kuleuven.peno3.mobiletoledo.server;
//
//import java.io.IOException;
//import com.google.gson.Gson;
//import be.kuleuven.peno3.mobiletoledo.model.Announcement;
//import be.kuleuven.peno3.mobiletoledo.Data.Client.Client;
//
//
//public class AnnouncementsClientDAO extends Client {
//	public static void main(String[] args){
//		Announcement[] announcements=getAnnouncements(1) ;
//		System.out.println(announcements[0].getTitle());
//		Announcement announcement=getAnnouncement(1);
//		System.out.println(announcement.getTitle());
//	}
//	public  static Announcement[] getAnnouncements(int course_id){
//		try {
//			String url ="course_id="+ course_id +"";
//			url="http://localhost:9876/AnnouncementHandler/getAnnouncements?"+url;
//			url=encode(url);
//			String json = stringOfUrl(url);
//			System.out.println(url);
//			Announcement[] announcements =new Gson().fromJson(json.toString(), Announcement[].class);
//			
//
//			return announcements;
//			
//		} catch (IllegalArgumentException e) {
//			e.printStackTrace();
//			return null;
//		}
//		catch (IOException e) {
//			e.printStackTrace();
//			return null;
//		}
//		
//	}
//	public static Announcement getAnnouncement(int announcement_id){
//		try{
//			String url ="announcement_id="+ announcement_id +"";
//			
//			url="http://localhost:9876/AnnouncementHandler/getAnnouncement?"+url;
//			//url=encode(url);
//			String json = stringOfUrl(url);
//			System.out.println(url);
//			Announcement[] announcements =new Gson().fromJson(json.toString(), Announcement[].class);
//			if (announcements !=null){
//				return announcements[0];
//			}
//			else {
//				return null;
//			}
//		}
//		catch (IOException e) {
//			e.printStackTrace();
//			return null;
//		}
//		
//		
//	}
//}
